﻿' ******************************************************************************
' ** 
' **  Yahoo! Managed
' **  Written by Marius Häusler 2011
' **  It would be pleasant, if you contact me when you are using this code.
' **  Contact: YahooFinanceManaged@gmail.com
' **  Project Home: http://code.google.com/p/yahoo-finance-managed/
' **  
' ******************************************************************************
' **  
' **  Copyright 2011 Marius Häusler
' **  
' **  Licensed under the Apache License, Version 2.0 (the "License");
' **  you may not use this file except in compliance with the License.
' **  You may obtain a copy of the License at
' **  
' **    http://www.apache.org/licenses/LICENSE-2.0
' **  
' **  Unless required by applicable law or agreed to in writing, software
' **  distributed under the License is distributed on an "AS IS" BASIS,
' **  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
' **  See the License for the specific language governing permissions and
' **  limitations under the License.
' ** 
' ******************************************************************************


Namespace YahooManaged.Finance

    ''' <summary>
    ''' Stores market quote informations
    ''' </summary>
    ''' <remarks></remarks>
    Public Class MarketQuoteData

        ''' <summary>
        ''' The name of the sector, industry or company.
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property Name() As String
        Public Property OneDayPriceChangePercent() As Double
        Public Property MarketCapitalizationInMillion() As Double
        Public Property PriceEarningsRatio() As Double
        Public Property ReturnOnEquityPercent() As Double
        Public Property DividendYieldPercent() As Double
        Public Property LongTermDeptToEquity() As Double
        Public Property PriceToBookValue() As Double
        Public Property NetProfitMarginPercent() As Double
        Public Property PriceToFreeCashFlow() As Double

        ''' <summary>
        ''' All market quote properties.
        ''' </summary>
        ''' <param name="prp">The market quote property you want to get or set.</param>
        ''' <value></value>
        ''' <returns>A value representing and depending on the passed property.</returns>
        ''' <remarks></remarks>
        Public Property Values(ByVal prp As MarketQuoteProperty) As Object
            Get
                Select Case prp
                    Case MarketQuoteProperty.Name : Return Me.Name
                    Case MarketQuoteProperty.DividendYieldPercent : Return Me.DividendYieldPercent
                    Case MarketQuoteProperty.LongTermDeptToEquity : Return Me.LongTermDeptToEquity
                    Case MarketQuoteProperty.MarketCapitalizationInMillion : Return Me.MarketCapitalizationInMillion
                    Case MarketQuoteProperty.NetProfitMarginPercent : Return Me.NetProfitMarginPercent
                    Case MarketQuoteProperty.OneDayPriceChangePercent : Return Me.OneDayPriceChangePercent
                    Case MarketQuoteProperty.PriceEarningsRatio : Return Me.PriceEarningsRatio
                    Case MarketQuoteProperty.PriceToBookValue : Return Me.PriceToBookValue
                    Case MarketQuoteProperty.PriceToFreeCashFlow : Return Me.PriceToFreeCashFlow
                    Case MarketQuoteProperty.ReturnOnEquityPercent : Return Me.ReturnOnEquityPercent
                    Case Else : Return Nothing
                End Select
            End Get
            Set(ByVal value As Object)
                Select Case prp
                    Case MarketQuoteProperty.Name : Me.Name = value.ToString
                    Case MarketQuoteProperty.DividendYieldPercent : Double.TryParse(value.ToString, Me.DividendYieldPercent)
                    Case MarketQuoteProperty.LongTermDeptToEquity : Double.TryParse(value.ToString, Me.LongTermDeptToEquity)
                    Case MarketQuoteProperty.MarketCapitalizationInMillion : Double.TryParse(value.ToString, Me.MarketCapitalizationInMillion)
                    Case MarketQuoteProperty.NetProfitMarginPercent : Double.TryParse(value.ToString, Me.NetProfitMarginPercent)
                    Case MarketQuoteProperty.OneDayPriceChangePercent : Double.TryParse(value.ToString, Me.OneDayPriceChangePercent)
                    Case MarketQuoteProperty.PriceEarningsRatio : Double.TryParse(value.ToString, Me.PriceEarningsRatio)
                    Case MarketQuoteProperty.PriceToBookValue : Double.TryParse(value.ToString, Me.PriceToBookValue)
                    Case MarketQuoteProperty.PriceToFreeCashFlow : Double.TryParse(value.ToString, Me.PriceToFreeCashFlow)
                    Case MarketQuoteProperty.ReturnOnEquityPercent : Double.TryParse(value.ToString, Me.ReturnOnEquityPercent)
                End Select
            End Set
        End Property

    End Class

End Namespace
